#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>

#define Swap(i) (((i)&(0xaaaaaaaa))>>1)|(((i)&(0x55555555))<<1)
int main()
{
	int a = 0;
	scanf("%d", &a);
	a = Swap(a);
	printf("%d", a);
	return 0;
}